from flask import Flask, render_template, request, jsonify
import prediction as pre

app = Flask(__name__)
app.config["DEBUG"] = True


@app.route('/')
def index():
    return render_template('/index.html')


@app.route('/api/prediction', methods=['POST'])
def prediction():
    data = request.form.to_dict()
    result = pre.predic(data)
    return jsonify({'code': 200, 'data': result})


if __name__ == '__main__':
    app.run()
